package tests;

import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import pages.PickYourDiamondsPage;
import pages.PickYourRingPage;
import utils.Log4Test;

/**
 * Created by sergey on 04.08.2014.
 */
public class AddProductsToCartNegativeUseCase extends BasicTest {
    @DataProvider
    public static Object[][] dp(){
        Object[][] dataArray = {{2072,2801,"0","sdbfw4b"}};
        return dataArray;}
    @BeforeTest
    public void deleteCookies()
    {
        driver.manage().deleteAllCookies();
    }
    @Test(dataProvider = "dp")
    public void addProducts(int metalTypeOptionsId, int metalTypeOptionValue,String quantityOfRings, String sizeOfRing)
    {
        PickYourDiamondsPage page = new PickYourDiamondsPage(driver);
        page.addDiamondToCart();
        PickYourRingPage page1 = new PickYourRingPage(driver);
        page1.addRingToCart();
        page1.selectMetalType(metalTypeOptionsId, metalTypeOptionValue);
        page1.enterRingSizeText(sizeOfRing);
        page1.inputQuantityOfRings(quantityOfRings);
        page1.addRingWithSizeToCart();
        Log4Test.info("WARNING: invalid data has been entered. Error message expected");
        Assert.assertFalse(page1.checkProceedingToCart(), Log4Test.fail("Expected error message, but proceeding to cart happened"));
    }
}
